package org.ricks.net.action.parser;

import java.io.IOException;
import java.lang.reflect.Type;

public interface ProtocolParser {
    // 支持 Type 类型反序列化
    <T> T deserialize(byte[] data, Type type) throws IOException;

    // 保留原方法（兼容简单类型）
    default <T> T deserialize(byte[] data, Class<T> clazz) throws IOException {
        return deserialize(data, (Type) clazz);
    }

    byte[] serialize(Object object) throws IOException;
}
